package com.jy.modules.cims.sysUtils;

import java.util.ArrayList;
import java.util.List;

import com.jy.modules.cims.data.common.dto.TCMmImgurlDTO;
import com.jy.modules.cims.data.interact.core.loan.response.ImgUrl;

public class ImgDtoConverter {
	
	private ImgDtoConverter(){};
	private static class Singletonholder{
		private static ImgDtoConverter instance = new ImgDtoConverter();
	}
	public static ImgDtoConverter getInstance(){
		return Singletonholder.instance;
	}
	
	public List<TCMmImgurlDTO> convert(List<ImgUrl>src){
		List<TCMmImgurlDTO>list=new ArrayList<TCMmImgurlDTO>(src.size());
		for(ImgUrl loan:src){
			TCMmImgurlDTO dest=new TCMmImgurlDTO();
			this.setValues(dest,loan);
			list.add(dest);
		}
		return list;
	}
	
	public TCMmImgurlDTO convert(ImgUrl src){
		TCMmImgurlDTO dest=new TCMmImgurlDTO();
		this.setValues(dest, src);
		return dest;
	}
	private void setValues(TCMmImgurlDTO dest,ImgUrl src){
		dest.setAttachCode(src.getAttachCode());
		dest.setAttachName(src.getAttachName());
		dest.setAttachUrl(src.getAttachUrl());
		dest.setContractNo(src.getContractNo());
		dest.setCustNo(src.getCustNo());
		dest.setGuarNo(src.getGuarNo());
		dest.setProductType(src.getProductType());
	}
}
